<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "login.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<table width="880" bgcolor="#FFFFFF" style="height:50px; color: #FF921C;" cellpadding="4" cellspacing="5">
	<tr style="vertical-align:middle;">
		<td>
			ADMIN PANEL
		</td>
		<?php if(isset($_SESSION['MM_Username'])) { ?>
		<td align="right">
		Welcome <?php echo $_SESSION['MM_Username'] ?> | <a href="<?php echo $logoutAction ?>">Disconnect</a> 
		</td>
		<?php } ?>
	</tr>
</table>